//
//  PositionSelectView.m
//  MyProject
//
//  Created by 石小强 on 2018/3/20.
//  Copyright © 2018年 yanjiaming. All rights reserved.
//

#import "PositionSelectView.h"
#import "PositionSelectCell.h"

@implementation PositionSelectView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self initSubViews];
    }
    return self;
}

- (void)initSubViews {
    self.backV = [[UIView alloc] initWithFrame:CGRectMake(kScreenWidth, 0, kScreenWidth, kScreenHeight)];
    [self addSubview:self.backV];
    UIButton *leftB = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 94, kScreenHeight)];
    [leftB setBackgroundColor:[UIColor clearColor]];
    [leftB addTarget:self action:@selector(leftBtnClick) forControlEvents:UIControlEventTouchUpInside];
    [self.backV addSubview:leftB];
    
    CGFloat tableW = (kScreenWidth - 94) * 0.5;
    self.cateOneTableView = [[UITableView alloc] initWithFrame:CGRectMake(94, 0, tableW, kScreenHeight) style:UITableViewStylePlain];
    self.cateOneTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.backV addSubview:self.cateOneTableView];
    [self.cateOneTableView registerNib:[UINib nibWithNibName:NSStringFromClass([PositionSelectCell class]) bundle:nil] forCellReuseIdentifier:@"selectCateOne"];
    
    self.cateTwoTableView = [[UITableView alloc] initWithFrame:CGRectMake(94 + tableW, 0, tableW, kScreenHeight) style:UITableViewStylePlain];
    self.cateTwoTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.cateTwoTableView.backgroundColor = kStyleColor;
    [self.backV addSubview:self.cateTwoTableView];
    [self.cateTwoTableView registerNib:[UINib nibWithNibName:NSStringFromClass([PositionSelectCell class]) bundle:nil] forCellReuseIdentifier:@"selectCateTwo"];
}

- (void)leftBtnClick {
    [UIView animateWithDuration:0.2 animations:^{
        self.backgroundColor = [UIColor clearColor];
        self.backV.mj_x = kScreenWidth;
    } completion:^(BOOL finished) {
        self.mj_x = kScreenWidth;
    }];
}


@end
